home *** CD-ROM | disk | FTP | other *** search
- //***** BEGIN LICENSE BLOCK *****
- //* Download Accelerator Plus Integration for Mozilla/Firefox.
- //*
- //* The contents of this file may be used under the terms of
- //* Download Accelerator Plus (DAP) End User License Agreement, also
- //* available at http://www.speedbit.com/Legal/DAPLICENSE.ASP ,
- //* and is subject to the Speedbit Privacy Policy, also available
- //* at http://www.speedbit.com/Legal/Privacy.ASP.
- //*
- //* Copyright (C) 1999-2006 SpeedBit Ltd.
- //***** END LICENSE BLOCK *****/
- ///////////////////////////////////////////////////////////////////////////////////////
- // context menu handler ( right click Download with DAP
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- function Handler(event, gContextMenu)
- {
- DAP_Log("Start Handler right click ");
- try
- {
- if ( !gContextMenu.onLink )
- {
- DAP_Log("nothing ");
- return;
- }
- if( !gDAPService )
- {
- DAP_Log("service is null");
- return;
- }
-
- if( !gDAPService._runDAP() )
- {
- DAP_Log("DAP not exist");
- return;
- }
-
-
- // for FireFox 1.0
- var url = 'getLinkURL' in gContextMenu ? gContextMenu.getLinkURL() : gContextMenu.linkURL();
- var doc = gContextMenu.target.ownerDocument;
- var href = doc.location.href;
-
- var description = getDescriptionFromDocument(doc);
- var cook = doc.cookie;
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
- var obj = gDAPService.getDAPComponent();
- if( obj )
- obj.RigthClickMenuDownload(url,href,cook,description,window.navigator.userAgent);
-
- }
- catch(ex)
- {
- DAP_Log(ex);
- }
-
- }
- //////////////////////////////////////////////////////////////////////////////////////////////////
- // handler :Download All with DAP
- //////////////////////////////////////////////////////////////////////////////////////////////////
- function HandlerAll(event, gContextMenu)
- {
- DAP_Log("Start Handler download all with DAP ");
-
- try
- {
-
- var target = event.originalTarget;
- var doc = gContextMenu.target.ownerDocument;
- if( !doc )
- return;
-
- if( !gDAPService )
- {
- DAP_Log("service is null");
- return;
- }
- if( !gDAPService._runDAP() )
- {
- DAP_Log("DAP not exist");
- return;
- }
-
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var obj = gDAPService.getDAPComponent();
- if( obj )
- obj.RigthClickMenuDownloadAll(doc,window.navigator.userAgent);
-
- }
- catch(ex)
- {
- DAP_Log(ex);
- }
- }
-
-
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /// add context menu to right click
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function DAPMenu()
- {
- try
- {
- DAP_Log("DAPMenu");
-
- var cm = gContextMenu;
-
- document.getElementById("dapctxmenu2").hidden = false;
- if (cm.onLink)
- document.getElementById("dapctxmenu1").hidden = false;
- else
- document.getElementById("dapctxmenu1").hidden = true;
- }
- catch(ex)
- {
- DAP_Log(ex);
- }
-
- }
-
-
- function DAPContextInit()
- {
- try
- {
-
- DAP_Log("DAPContextInit");
- document.getElementById("contentAreaContextMenu").addEventListener("popupshowing",DAPMenu,false);
-
- } catch (e) {
-
- DAP_Log(e);
-
- }
-
-
-
- }
-
- // add context menu
- window.addEventListener("load",DAPContextInit,false);
-
-
-
-
-